package com.yonyou.brigade.third_parties.yihao.controller;

import com.yonyou.brigade.basic_init.enums.ChannelEnum;
import com.yonyou.brigade.basic_init.model.BriChannel;
import com.yonyou.brigade.basic_init.service.IBriChannelService;
import com.yonyou.brigade.third_parties.yihao.service.ICLYHOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
@RequestMapping("/yihao")
public class OrderTestController {

    @Autowired
    @Qualifier("CLYHOrderServiceImpl")
    private ICLYHOrderService CLYHOrderService;

    @Autowired
    @Qualifier("briChannelServiceImpl")
    private IBriChannelService briChannelService;

    @RequestMapping(value = "/getOrderList",method = RequestMethod.POST)
    public void testOrders(){
        List<BriChannel> briChannels = briChannelService.getEnableChannelByChannel(ChannelEnum.CLYH.getName());
        if (briChannels != null && briChannels.size() > 0) {
            for (int i = 0; i < briChannels.size(); i++) {
                BriChannel briChannel = briChannels.get(i);
                String tenant = briChannel.getTenant();
                String orgpk = briChannel.getOrgpk();
                String begin = "2018-11-01";
                String end = "2018-11-13";
                CLYHOrderService.getOrderList(tenant, orgpk, begin, end, briChannel);
            }
        }
    }
}
